package com.example.jetpackdemo.common

import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingSource

fun <T : Any> PagingSource<Int, T>.createPager(pageSize: Int, defaultSize: Int): Pager<Int, T> {
    return Pager<Int, T>(
        config = PagingConfig(
            pageSize = pageSize,
            prefetchDistance = 10,
            enablePlaceholders = false,
            initialLoadSize = defaultSize
        ), pagingSourceFactory = { this }
    )
}